package com.itheima.delaytask.feign;

import com.itheima.delaytask.dto.Task;
import com.itheima.response.ResponseMessage;
import org.springframework.web.bind.annotation.*;

/**
 * @program: virtual-trade-parent
 * @description: feign接口, 调用taskController接口
 * @author: zhanghz001
 * @create: 2021-07-11 22:24
 **/
// @FeignClient(name = "delay-task-service", fallbackFactory = ZhzTaskServiceFallbackFactory.class)
public interface ZhzTaskService {
    
    /**
     * 添加任务
     *
     * @param task
     * @return
     */
    @PostMapping("/task/push")
    public ResponseMessage pushTask(@RequestBody Task task);
    
    /**
     * 消费任务
     *
     * @param type
     * @param priority
     * @return
     */
    @GetMapping("/task/poll/{type}/{priority}")
    public ResponseMessage pollTask(@PathVariable("type") Integer type,
                                    @PathVariable("priority") Integer priority);
    
    /**
     * 取消任务
     *
     * @param taskId
     * @return
     */
    @PostMapping("/task/cancel")
    public ResponseMessage cancelTask(@RequestParam("taskId") Long taskId);
    
    @GetMapping("/refresh")
    public ResponseMessage refresh();
}
